#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2018/11/19 22:16
@desc
"""

from xpinyin import Pinyin  # 导入拼音模块

if __name__ == '__main__':
    tup1 = ['太原','长治','运城','临汾','晋中','大同','忻州','吕梁','朔州','阳泉','晋城','清徐','阳曲','怀仁']  # 设置元组，循环取元组中的元素
    for i in tup1:
        city = str(i)  # 构建拼音，这样每次就只要改这里的城市名就可以了
        city = city.decode('utf-8')  # unicode(city, 'utf-8')
        citypy = Pinyin()  # 实例化拼音模块的函数
        citypy = str(citypy.get_pinyin(city, ''))  # 还有其他转换拼音的方法，比如在两个字之间加符号等
        # print('citypy:' + citypy)

        res_path = 'D:\\iProject\\myPython\\com\\teradata\\laccelllatitude\\'
        file_name = '%s%s.txt' % (res_path, citypy)
        print(file_name)


